package com.shengde.jinwawaforleader.model.myJob.adapter;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.shengde.jinwawaforleader.R;
import com.shengde.jinwawaforleader.network.protocolbean.ProVideoList;

import java.util.List;


/**
 * 使用介绍，适配器 宿主： 使用介绍：MyOrderActivity 启动项： 我的订单：
 * */
public class MingshiShipinAdapter extends BaseAdapter {

	protected Context context;
	private TextView tvAmount;
	Drawable daSex;

	Dialog dialogLoading;
	Intent intent;
	List<ProVideoList.DataListEntity> list;

	public MingshiShipinAdapter(List<ProVideoList.DataListEntity> mList,
								Context context) {
		this.list = mList;
		this.context = context;
	}

	@Override
	public int getCount() {
		return (list == null) ? 0 : list.size();
	}

	@Override
	public Object getItem(int position) {
		return (list == null) ? null : list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		if (list == null || list.size() <= 0) {
			return convertView;
		}
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(
					R.layout.item_shifanke, parent, false);
			holder.image = (ImageView) convertView.findViewById(R.id.image);
			holder.title = (TextView) convertView.findViewById(R.id.title);
			holder.describe = (TextView) convertView.findViewById(R.id.describe);;
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		Glide.with(context).load(list.get(position).getCover()).error(R.drawable.iconfont_icon9).into(holder.image);
		holder.title.setText(list.get(position).getTitle());
		holder.describe.setText(list.get(position).getBrief());
		return convertView;
	}

	protected final class ViewHolder {

		public ImageView image;
		public TextView title,describe;
	}
}
